#ifndef _TLOG_H
#define	_TLOG_H

/*
 * 
 * BUGs & TODOs:
 *
 * 1) There is no sign of error handling in the code.
 * 2) Add custom formatters for messages.
 * 3) Add another option to allow overwriting of tail
 *    instead of waiting in case of overflow.
 *
 */

#include <stdlib.h> /* for size_t */

/* Instance of log */
struct tlog_instance;

/* Log levels */
#define LL_FATAL 0 /* Application can't continue to function */
#define LL_ERROR 1 /* Application can continue with loss of functionality  */
#define LL_WARNING 2 /* Applucation can continue w/o loss of functionality */
#define LL_INFO 3 /* Information for user */
#define LL_DEBUG 4 /* Information for developer */
#define LL_TRACE 5 /* Control flow trace */

/* Log instance options */
struct tlog_options
{
	size_t max_message_size; /* Size of buffer for log message */
	size_t log_queue_size; /* Size of log queue */
};

/* Log manipulation functions */

struct tlog_instance *tlog_init(int fd, struct tlog_options *opts);
void tlog_cleanup(struct tlog_instance *inst);

/* Logging */

// void tlog_log(struct tlog_instance *inst, int level, const char *format, ...);
void tlog_log(struct tlog_instance *inst, int level, const char *message);

#endif	/* _TLOG_H */
